Test Series - Data Structure

Test Number 75/115

Q: How many child nodes does each node of K-ary Tree contain?
A. 2
B. 3
C. more than k
D. at most k
Solution: Each node of K-ary tree contains at most k nodes. While tree with 2 nodes is called Binary tree and tree with 3 nodes is called Ternary tree.
Q: Which of the following is the name of the node having child nodes?
A. Brother
B. Sister
C. Mother
D. Parent
Solution: Parent node is the node having child nodes and child nodes may contain references to their parents. Parent node is a node connected by a directed edge to its child.
Q: What is the depth of the root node of K-ary tree?
A. 2
B. 1
C. 0
D. 3
Solution: Depth is defined as the length of the path from root to the node. So the depth of root node in K-ary tree is 0.
Q: What is the Height of the root node of K-ary tree?
A. 1
B. 2
C. 3
D. 0
Solution: Height of K-ary tree is defined as the length of path from root to deepest node in tree. Therefore, height of root node in K-ary tree is 0.
Q: Can leaf node be called child node in a K-ary tree?
A. True
B. false
C. ...
D. ...
Solution: Leaf node is a node that has no child. Since Leaf node will always be the node on the last level of k-ary tree, so it can be called child node of given parent node in K-ary tree.
Q: Can child node be always called Leaf node in the K-ary tree?
A. True
B. False
C. ...
D. ...
Solution:  Leaf node is any node that does not contain any children. Child node may or may not contain more nodes. Child node will only be called leaf Node if the node has no child node.
Q: What is the upper bound for maximum leaves in K-ary tree with height h?
A. K*h
B. K^h
C. K+h
D. K-h
Solution:  In the K-ary tree having height h, the upper bound for having maximum number of leaves is k^h.
Q: What is the height of a K-ary tree having only root node?
A. 1
B. 0
C. 2
D. 3
Solution: Height of a K-ary tree does not include the root node. So the height of the K-ary tree is without root node is 0.
Q: Which one of the following is the correct formulae to find the parent node at index I?
A. (I-1)/K
B. (I+1)/K
C. (I*1)/K
D. (I-2)/K
Solution: The parent node for the node of index I in a K-ary tree is given by (I-1)/K.
Q: How many extra nodes are there in Full K-ary tree than complete K-ary tree?
A. 1
B. 2
C. 3
D. Both have same number of nodes
Solution: Every Full K-ary tree is also a complete K-ary tree. Therefore, both have same number of nodes.

You Have Score    /10